package com.zhiwei.controller;

import com.zhiwei.pojo.Stock;
import com.zhiwei.service.StockService;
import com.zhiwei.vo.PageResult;
import com.zhiwei.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/stock")
public class StockController {
    @Autowired
    private StockService stockService;
    @GetMapping("/list/")
    public SysResult getStockList(PageResult pageResult){
        List<Stock> stocks = stockService.getStockList(pageResult);
        return SysResult.success(stocks);
    }
    @GetMapping("/update/{id}")
    public SysResult updateStatus(@PathVariable Integer id){
        return SysResult.success(stockService.updateStatus(id));
    }
}
